package com.itmiaojie.dao;

import com.github.pagehelper.Page;
import com.itmiaojie.pojo.CheckGroup;
import com.itmiaojie.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface CheckGroupDao {

    void add(CheckGroup checkGroup);

    void setCheckGroupAndCheckItem(Map<String, Integer> map);

    Page<CheckGroup> selectByCondition(String queryString);

    @Select("select * from t_checkgroup where id = #{id} ")
    CheckGroup selectById(Integer id);

    @Select("select * from t_checkgroup ")
    List<CheckGroup> selectAll();

    @Select("  select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{id} ")
    List<Integer> findCheckItemIdsByCheckGroupId(Integer id);
    /*<!--根据检查组id删除中间表数据（清理原有关联关系）-->*/
    @Delete("delete from t_checkgroup_checkitem where checkgroup_id = #{id} ")
    void deleteAssociation(Integer id);

    void edit(CheckGroup checkGroup);
    @Delete("delete from t_checkgroup where id = #{id} ")
    void delete(Integer id);

    CheckGroup findCheckGroupById(Integer id);
}
